<?php if (!defined('THINK_PATH')) exit(); /*a:6:{s:76:"D:\phpstudy_pro\WWW\thinkphp\public/../application/home\view\index\info.html";i:1649937337;s:62:"D:\phpstudy_pro\WWW\thinkphp\application\home\view\layout.html";i:1649407092;s:67:"D:\phpstudy_pro\WWW\thinkphp\application\home\view\common\meta.html";i:1649407092;s:69:"D:\phpstudy_pro\WWW\thinkphp\application\home\view\common\script.html";i:1649407092;s:69:"D:\phpstudy_pro\WWW\thinkphp\application\home\view\common\header.html";i:1649407092;s:69:"D:\phpstudy_pro\WWW\thinkphp\application\home\view\common\footer.html";i:1649407092;}*/ ?>
 
 
<!DOCTYPE html>
<html>
<head>
<!-- 头部信息 -->
<meta charset="utf-8">
  <title><?php echo $System['SiteName']; ?></title>
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  <meta name="keywords" content="<?php echo $System['keywords']; ?>">
  <meta name="description" content="<?php echo $System['description']; ?>">
  <link rel="shortcut icon" href="<?php echo $System['SiteLogo']; ?>" />
  <link rel="stylesheet" href="/assets/home/layui/css/layui.css">
  <link rel="stylesheet" href="/assets/home/css/global.css">
  <link rel="stylesheet" href="/assets/home/css/common.css" />
<!-- js信息 -->
<script src="/assets/home/layui/layui.js"></script>
<script>
    //预加载
    window.onload = function(){
      layui.cache.page = '';
      layui.cache.user = {
        username: '游客'
        ,uid: -1
        ,avatar: '/assets/home/images/avatar/00.jpg'
        ,experience: 83
        ,sex: '男'
      };
      layui.config({
        version: "3.0.0"
        ,base: '/assets/home/mods/' //这里实际使用时，建议改成绝对路径
      }).extend({
        fly: 'index'
      }).use('fly');
    }
</script>

</head>
<body>

<!-- 头部文件 -->
<div class="fly-header layui-bg-black">
  <div class="layui-container">
    <a class="fly-logo" href="/">
      <img src="/assets/home/images/logo.png" alt="layui">
    </a>

    <ul class="layui-nav fly-nav-user">



      <!-- 登入后的状态 -->
      <?php if(\think\Cookie::get('LoginUser')): ?>
      <li class="layui-nav-item">
        <a class="fly-nav-avatar" href="javascript:;">
          <cite class="layui-hide-xs"><?php echo \think\Cookie::get('LoginUser')['nickname']; ?></cite>
          <i class="iconfont icon-renzheng layui-hide-xs" title="认证信息：layui 作者"></i>
          <i class="layui-badge fly-badge-vip layui-hide-xs">VIP3</i>
          <img src="<?php echo \think\Cookie::get('LoginUser')['avatar']; ?>">
        </a>
        <dl class="layui-nav-child">
          <dd><a href="<?php echo url('home/user/index'); ?>"><i class="layui-icon" style="margin-left: 2px; font-size: 22px;">&#xe68e;</i>我的主页</a></dd>
          <dd><a href="<?php echo url('home/user/user',['setup'=>1]); ?>"><i class="layui-icon">&#xe620;</i>基本设置</a></dd>
          <dd><a href="<?php echo url('home/post/index',['setup'=>2]); ?>"><i class="iconfont icon-tongzhi" style="top: 4px;"></i>我的帖子</a></dd>
          
          <hr style="margin: 5px 0;">
          <dd><a href="<?php echo url('home/index/logout'); ?>" style="text-align: center;">退出</a></dd>
        </dl>
      </li>

      <?php else: ?>
      <!-- 未登入的状态 -->
      <li class="layui-nav-item">
        <a class="iconfont icon-touxiang layui-hide-xs" href="<?php echo url('home/user/index'); ?>"></a>
      </li>
      <li class="layui-nav-item">
        <a href="<?php echo url('home/index/login'); ?>">登入</a>
      </li>
      <li class="layui-nav-item">
        <a href="<?php echo url('home/index/register'); ?>">注册</a>
      </li>
      <?php endif; ?>
    </ul>
  </div>
</div>

<!-- 子模板变量 -->
<!-- 在线网页编辑器引入 -->
<link rel="stylesheet" href="/static/kindeditor/themes/default/default.css" />
<script src="/static/kindeditor/kindeditor-all-min.js"></script>
<script src="/static/kindeditor/lang/zh-CN.js"></script>
<script>
  var editor;
  KindEditor.ready(function (K) {
    editor = K.create('textarea[name="content"]', {
      allowFileManager: true
    });
  })
</script>

<div class="layui-hide-xs">
  <div class="fly-panel fly-column">
    <div class="layui-container">
      <ul class="layui-clear">
        <li class="layui-hide-xs <?php echo $cateid==0?'layui-this' : ''; ?>"><a href="/">全部</a></li>
        <?php foreach($catelist as $cate): ?>
        <li class="<?php echo $cateid==$cate['id']?'layui-this' : ''; ?>">
          <a href="<?php echo url('home/index/index',['cateid' => $cate['id']]); ?>"><?php echo $cate['name']; ?></a>
        </li>
        <?php endforeach; ?>

        <!-- 用户登入后显示 -->
        <li class="layui-hide-xs layui-hide-sm layui-show-md-inline-block"><a href="../user/index.html">我发表的贴</a></li>
        <li class="layui-hide-xs layui-hide-sm layui-show-md-inline-block"><a
            href="../user/index.html#collection">我收藏的贴</a></li>
      </ul>

      <div class="fly-column-right layui-hide-xs">
        <span class="fly-search"><i class="layui-icon"></i></span>
        <a href="add.html" class="layui-btn">发表新帖</a>
      </div>
      <div class="layui-hide-sm layui-show-xs-block"
        style="margin-top: -10px; padding-bottom: 10px; text-align: center;">
        <a href="add.html" class="layui-btn">发表新帖</a>
      </div>
    </div>
  </div>
</div>

<div class="layui-container">
  <div class="layui-row layui-col-space15">
    <div class="layui-col-md8 content detail">
      <div class="fly-panel detail-box">
        <h1><?php echo $postinfo['title']; ?></h1>
        <div class="fly-detail-info">
          <?php if($postinfo['accept']): ?>
          <span class="layui-badge" style="background-color: #5FB878;">已结</span>
          <?php else: ?>
          <span class="layui-badge" style="background-color: #999;">未结</span>
          <?php endif; if($postinfo['state'] == 1): ?>
          <span class="layui-badge layui-bg-red">置顶</span>
          <?php elseif($postinfo['state'] == 2): ?>
          <span class="layui-badge layui-bg-red">精华</span>
          <?php elseif($postinfo['state'] == 3): ?>
          <span class="layui-badge layui-bg-red">热门</span>
          <?php endif; ?>

          <div class="fly-admin-box" data-id="123">
            <?php if($postinfo['user']['id'] == \think\Cookie::get('LoginUser')['id']): ?>
            <span class="layui-btn layui-btn-xs jie-admin" type="del" id="del">删除</span>
            <?php endif; ?>

            <!-- <span class="layui-btn layui-btn-xs jie-admin" type="set" field="stick" rank="1">置顶</span>  -->
            <!-- <span class="layui-btn layui-btn-xs jie-admin" type="set" field="stick" rank="0" style="background-color:#ccc;">取消置顶</span> -->

            <!-- <span class="layui-btn layui-btn-xs jie-admin" type="set" field="status" rank="1">加精</span>  -->
            <!-- <span class="layui-btn layui-btn-xs jie-admin" type="set" field="status" rank="0" style="background-color:#ccc;">取消加精</span> -->
          </div>
          <span class="fly-list-nums">
            <a href="#comment"><i class="iconfont" title="回答">&#xe60c;</i> <?php echo $count; ?></a>
            <i class="iconfont" title="人气">&#xe60b;</i> <?php echo $VisitCount; ?>
          </span>
        </div>
        <div class="detail-about">
          <a class="fly-avatar" href="<?php echo url('home/user/index', ['userid' => $postinfo['user']['id']]); ?>">
            <?php if($postinfo['user']['avatar']): ?>
            <img src="/<?php echo $postinfo['user']['avatar']; ?>">
            <?php else: ?>
            <img src="/assets/home/images/avatar.jpg">
            <?php endif; ?>

          </a>
          <div class="fly-detail-user">
            <a href="../user/home.html" class="fly-link">
              <cite><?php echo $postinfo['user']['nickname']; ?></cite>
              <?php if($postinfo['user']['auth'] == 1): ?>
              <i class="iconfont icon-renzheng" title="认证信息：{{ rows.user.approve }}"></i>
              <?php endif; if($postinfo['user']['vip'] > 0): ?>
              <i class="layui-badge fly-badge-vip">VIP</i>
              <?php endif; ?>
            </a>
            <span><?php echo $postinfo['createtime']; ?></span>
          </div>
          <div class="detail-hits" id="LAY_jieAdmin" data-id="123">
            <span style="padding-right: 10px; color: #FF7200">悬赏：<?php echo $postinfo['point']; ?>积分</span>
            <?php if($postinfo['user']['id'] == \think\Cookie::get('LoginUser')['id']): ?>
            <span class="layui-btn layui-btn-xs jie-admin" type="edit"><a
                href="<?php echo url('home/post/edit', ['postid' => $postinfo['id']]); ?>">编辑此贴</a></span>
            <?php endif; ?>

            <!-- 收藏 -->
            <?php if(\think\Cookie::get('LoginUser')): if($CollectStatus): ?>
            <span class="layui-btn layui-btn-xs jie-admin layui-bg-black" type="edit" id="CollectDel">
              <a href="javascript:void(0)">取消收藏</a>
            </span>
            <?php else: ?>
            <span class="layui-btn layui-btn-xs jie-admin layui-bg-blue" type="edit" id="CollectAdd">
              <a href="javascript:void(0)">收藏</a>
            </span>
            <?php endif; endif; ?>
          </div>
        </div>
        <div class="detail-body photos">
          <p>
            <?php echo $postinfo['content']; ?>
          </p>
        </div>
      </div>

      <div class="fly-panel detail-box" id="flyReply">
        <fieldset class="layui-elem-field layui-field-title" style="text-align: center;">
          <legend>回帖</legend>
        </fieldset>

        <ul class="jieda" id="jieda">
          <?php if($commentlist): ?>
          <?php echo CommentHtml($commentlist,$postinfo); else: ?>
          <!-- 无数据时 -->
          <li class="fly-none">消灭零回复</li>
          <?php endif; ?>
        </ul>

        <!-- 评论的表单 -->
        <?php if(!$postinfo['accept'] AND \think\Cookie::get('LoginUser')): ?>
        <div class="layui-form layui-form-pane">
          <form action="<?php echo url('home/comment/add'); ?>" method="post">
            <div class="layui-form-item layui-form-text">
              <h2 id="reply-name"></h2>
              <div class="layui-input-block">
                <textarea id="content" name="content" class="layui-textarea" style="height: 300px;"></textarea>
              </div>
            </div>
            <div class="layui-form-item">
              <input type="hidden" name="postid" value="<?php echo $postinfo['id']; ?>">
              <input type="hidden" name="pid" value="">
              <button class="layui-btn" type="submit">提交回复</button>
            </div>
          </form>
        </div>
        <?php endif; ?>
      </div>
    </div>
    <div class="layui-col-md4">
      <dl class="fly-panel fly-list-one">
        <dt class="fly-panel-title">本周热议</dt>
        <dd>
          <a href="">基于 layui 的极简社区页面模版</a>
          <span><i class="iconfont icon-pinglun1"></i> 16</span>
        </dd>
        <dd>
          <a href="">基于 layui 的极简社区页面模版</a>
          <span><i class="iconfont icon-pinglun1"></i> 16</span>
        </dd>
        <dd>
          <a href="">基于 layui 的极简社区页面模版</a>
          <span><i class="iconfont icon-pinglun1"></i> 16</span>
        </dd>
        <dd>
          <a href="">基于 layui 的极简社区页面模版</a>
          <span><i class="iconfont icon-pinglun1"></i> 16</span>
        </dd>
        <dd>
          <a href="">基于 layui 的极简社区页面模版</a>
          <span><i class="iconfont icon-pinglun1"></i> 16</span>
        </dd>
        <dd>
          <a href="">基于 layui 的极简社区页面模版</a>
          <span><i class="iconfont icon-pinglun1"></i> 16</span>
        </dd>
        <dd>
          <a href="">基于 layui 的极简社区页面模版</a>
          <span><i class="iconfont icon-pinglun1"></i> 16</span>
        </dd>
        <dd>
          <a href="">基于 layui 的极简社区页面模版</a>
          <span><i class="iconfont icon-pinglun1"></i> 16</span>
        </dd>
        <dd>
          <a href="">基于 layui 的极简社区页面模版</a>
          <span><i class="iconfont icon-pinglun1"></i> 16</span>
        </dd>
        <dd>
          <a href="">基于 layui 的极简社区页面模版</a>
          <span><i class="iconfont icon-pinglun1"></i> 16</span>
        </dd>

        <!-- 无数据时 -->
        <!--
           <div class="fly-none">没有相关数据</div>
           -->
      </dl>

      <div class="fly-panel">
        <div class="fly-panel-title">
          这里可作为广告区域
        </div>
        <div class="fly-panel-main">
          <a href="http://layim.layui.com/?from=fly" target="_blank" class="fly-zanzhu"
            time-limit="2017.09.25-2099.01.01" style="background-color: #5FB878;">LayIM 3.0 - layui 旗舰之作</a>
        </div>
      </div>

      <div class="fly-panel" style="padding: 20px 0; text-align: center;">
        <img src="../../res/images/weixin.jpg" style="max-width: 100%;" alt="layui">
        <p style="position: relative; color: #666;">微信扫码关注 layui 公众号</p>
      </div>

    </div>
  </div>
</div>
<script>
  layui.use('layer', function () {
    var layer = layui.layer
    var $ = layui.jquery

    // 添加收藏
    $("#CollectAdd").click(function () {
      $.ajax({
        type: "POST",
        url: `<?php echo url('home/collect/add'); ?>`,
        data: `postid=<?php echo $postinfo['id']; ?>`,
        dataType: "json",
        success: function (data) {
          if (data.result) {
            //成功
            layer.msg(data.msg, {
              icon: 1,
              time: 2000 //2秒关闭（如果不配置，默认是3秒）
            }, function () {
              //直接刷新界面
              location.reload()
            })
          } else {
            //失败
            layer.msg(data.msg)
          }
        }
      })
    })

    //取消收藏
    $("#CollectDel").click(function () {
      $.ajax({
        type: "POST",
        url: `<?php echo url('home/collect/del'); ?>`,
        data: `postid=<?php echo $postinfo['id']; ?>`,
        dataType: "json",
        success: function (data) {
          if (data.result) {
            //成功
            layer.msg(data.msg, {
              icon: 1,
              time: 2000 //2秒关闭（如果不配置，默认是3秒）
            }, function () {
              //直接刷新界面
              location.reload()
            })
          } else {
            //失败
            layer.msg(data.msg)
          }
        }
      })
    })

    // 删除帖子
    $("#del").click(function () {
      layer.confirm('是否确认删除', {
        icon: 3,
        title: '提示'
      }, function (index) {

        //关闭弹框
        layer.close(index)

        $.ajax({
          type: 'POST',
          url: `<?php echo url('home/post/delete'); ?>`,
          data: `postid=<?php echo $postinfo['id']; ?>`,
          dataType: 'json',
          success: function (data) {
            if (data.result) {
              //成功
              layer.msg(data.msg, {
                icon: 1,
                time: 2000 //2秒关闭（如果不配置，默认是3秒）
              }, function () {
                location.href = "<?php echo url('home/index/index'); ?>"
                return false
              })
            } else {
              //删除失败
              layer.msg(data.msg)
            }
          }
        })

      })
    })

    // 删除评论
    $(".delcomment").click(function () {
      delid = $(this).data("id")
      layer.confirm('是否确认删除', {
        icon: 3,
        title: '提示'
      }, function (index) {

        //关闭弹框
        layer.close(index)

        $.ajax({
          type: 'POST',
          url: `<?php echo url('home/post/deletecommet'); ?>`,
          data: `postid=${delid}`,
          dataType: 'json',
          success: function (data) {
            if (data.result) {
              //成功
              layer.msg(data.msg, {
                icon: 1,
                time: 2000 //2秒关闭（如果不配置，默认是3秒）
              }, function () {
                location.reload()
                return false
              })
            } else {
              //删除失败
              layer.msg(data.msg)
            }
          }
        })

      })
    })


    // 点击回复
    $(".reply").click(function () {
      var pid = $(this).data("pid");
      var nickname = $(this).data('nickname')
      $("#reply-name").html("回复给：" + nickname)
      $("input[name='pid']").val(pid)
    })

    // 点赞
    $(".thumbs").click(function () {

      var id = $(this).data('id');
      $.ajax({
        type: "POST",
        url: `<?php echo url('home/comment/thumbs'); ?>`,
        data: `id=${id}`,
        dataType: "json",
        success: function (data) {
          if (data.result) {
            //成功
            layer.msg(data.msg, {
              icon: 1,
              time: 2000 //2秒关闭（如果不配置，默认是3秒）
            }, function () {
              //直接刷新界面
              location.reload()
            })
          } else {
            //失败
            layer.msg(data.msg)
          }
        }
      })
    })

    //采纳
    $(".accept").click(function () {

      var comid = $(this).data('comid')
      $.ajax({
        type: "POST",
        url: `<?php echo url('home/comment/accept'); ?>`,
        data: `comid=${comid}`,
        dataType: "json",
        success: function (data) {
          if (data.result) {
            //成功
            layer.msg(data.msg, {
              icon: 1,
              time: 2000 //2秒关闭（如果不配置，默认是3秒）
            }, function () {
              //直接刷新界面
              location.reload()
            })
          } else {
            //失败
            layer.msg(data.msg)
          }
        }
      })
    })

    //取消采纳
    $(".iconfont").click(function () {

      var comid = $(this).data('comid')
      $.ajax({
        type: "POST",
        url: `<?php echo url('home/comment/accept'); ?>`,
        data: `comid=${comid}`,
        dataType: "json",
        success: function (data) {
          if (data.result) {
            //成功
            layer.msg(data.msg, {
              icon: 1,
              time: 2000 //2秒关闭（如果不配置，默认是3秒）
            }, function () {
              //直接刷新界面
              location.reload()
            })
          } else {
            //失败
            layer.msg(data.msg)
          }
        }
      })
    })

  })
</script>

<!-- 底部（footer）文件 -->
 <div class="fly-footer">
    <p>2017 &copy; <a href="http://www.layui.com/" target="_blank">Fly技术社区</a></p>
  </div>

</body>
</html>